<?php
namespace app\admin\controller;

use app\common\controller\AdminBase;
use app\common\model\Dict;
use app\common\model\DictData;

class Common extends AdminBase
{
    /**
     * 读取自定义参数
     * @return void
     */
    public function get_param($name='')
    {
        $list = get_param($name);
        $this->result(compact('list'));
    }

    /**
     * 获取字典配置
     * @param $dict_id
     * @return void
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function get_dict($dict_id='')
    {
        // 字典类别
        $dict = Dict::find($dict_id);
        $model = new DictData();
        $list = $model->where('dict_id',$dict_id)->field('id,pid,name,value,is_default')->order('sort_order desc,id desc')->select();
        $this->result(compact('dict','list'));
    }




}
